#include <iostream>
#include <list>
#include <cstring>

using namespace std;

#define MAX_DICT_SIZE 10000
#define MAX_WORD_SIZE 16

typedef list<char*> STRING_LIST;

char DICT[MAX_DICT_SIZE+1][MAX_WORD_SIZE];

enum MATCHING_LEVEL
{
    MATCHING_LEVEL__FULL,
    MATCHING_LEVEL__CAN_CORRECT,
    MATCHING_LEVEL__CANNOT_CORRECT,
};

MATCHING_LEVEL check_word(const char* word, const char* dict_word)
{
    unsigned int i = 0;
    MATCHING_LEVEL res = MATCHING_LEVEL__CANNOT_CORRECT;

    while((word[i] == dict_word[i]) &&
          (word[i] != '\0') &&
          (dict_word[i] != '\0'))
          i++;

    if ((word[i] == '\0') && (dict_word[i] == '\0'))
    {
        res = MATCHING_LEVEL__FULL;
    }
    else
    {
        if (word[i] != '\0')
        {
            if (strcmp(&word[i+1], &dict_word[i]) == 0)
            {
                // can correct it by del a char
                res = MATCHING_LEVEL__CAN_CORRECT;
            }
        }

        if ((res != MATCHING_LEVEL__CAN_CORRECT) && (dict_word[i] != '\0'))
        {
            if (strcmp(&word[i], &dict_word[i+1]) == 0)
            {
                // can correct it by insert a char
                res = MATCHING_LEVEL__CAN_CORRECT;
            }
        }

        if ((res != MATCHING_LEVEL__CAN_CORRECT) &&
            (word[i] != '\0') &&
            (dict_word[i] != '\0'))
        {
            if (strcmp(&word[i+1], &dict_word[i+1]) == 0)
            {
                // can correct it by replace a char
                res = MATCHING_LEVEL__CAN_CORRECT;
            }
        }
    }

    return res;
}

int main(void)
{
    unsigned int i = 0;
    unsigned int dict_size = 0;
    char word[MAX_WORD_SIZE];
    STRING_LIST corrected_word_list;

    // read in the dictionary
    while(cin.getline(DICT[dict_size], MAX_WORD_SIZE) && (DICT[dict_size++][0] != '#'));

    dict_size--;

    //while(i != 0) cout<<DICT[--i]<<endl;

    while(cin.getline(word, MAX_WORD_SIZE) && (word[0] != '#'))
    {
        MATCHING_LEVEL res = MATCHING_LEVEL__CANNOT_CORRECT;

        for(i = 0; i < dict_size; i++)
        {
            res = check_word(word, DICT[i]);

            if (res == MATCHING_LEVEL__FULL)
            {
                break;
            }
            else if (res == MATCHING_LEVEL__CAN_CORRECT)
            {
                corrected_word_list.push_back(DICT[i]);
            }
        }

        if (res == MATCHING_LEVEL__FULL)
        {
            cout<<word<<" is correct"<<endl;
            corrected_word_list.clear();
        }
        else if (!corrected_word_list.empty())
        {
            cout<<word<<":";
            for(STRING_LIST::iterator it = corrected_word_list.begin();
                it != corrected_word_list.end();
                it++)
            {
                cout<<" "<<*it;
            }
            cout<<endl;
            corrected_word_list.clear();
        }
        else
        {
            cout<<word<<":"<<endl;
        }
    }

    return 0;
}

